<?php

namespace app\admin\controller;


use app\admin\model\Plate;
use cmf\controller\AdminBaseController;
use OpenApi\Annotations\Examples;
use think\exception\HttpResponseException;
use think\facade\Db;
use think\Response;
use cmf\phpqrcode;


class PlateController extends AdminBaseController
{
    //钢卷捆包追溯
    public function seekunbao(){
        $id = input('id');
        $info = Plate::where('id', $id)->find();
        if(!$info['coil_id']){
            $info['coil_id']=$this->getkunbao($id);
        }
        $this->success($info['coil_id']);
    }

    function getkunbao($id){
        $info1 = Plate::where('id', $id)->find();
        if(!isset($info1['parent_id'])){
              return false;
        }
            if (!$info1['coil_id']) {
                $info1['coil_id']['coil_id'] = $this->getkunbao($info1['parent_id']);

            } else {
                return $info1['coil_id'];
            }

    }

    public function qr()
    {

//    include "phpqrcode/qrlib.php";

// 二维码内容


    }
    public function updateprice()
    {
        $po_price = input('po_price');
        $id = input('id');
//
        $params['po_price'] = $po_price;
        $params['id'] = $id;
        $params['update_time'] = time();
        $params['admin_id'] = cmf_get_current_admin_id();
        Plate::update($params);
        cmf_install_log($params, 'plate_log', 'update');
        $this->success('成功');
    }

    /**拆包功能
     * @return void
     */
    public function unpackindex()
    {
        return $this->fetch('', ['domain' => request()->domain() . '/upload/']);
    }

    public function updatekuwei()
    {
        $kuwei = input('kuwei');
        $id = input('id');
        $params['kuwei'] = $kuwei;
        $params['id'] = $id;
        $params['update_time'] = time();
        $params['admin_id'] = cmf_get_current_admin_id();
        Plate::update($params);
        cmf_install_log($params, 'plate_log', 'update');
        $this->success('成功');
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '钢板盘点库存202403',
     *     'parent' => 'admin/Plate/de',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function indexpandian()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);

        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);
        $company_id_arr = Db::name('company')
            ->column('name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');


        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }


        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $this->assign('type_arr1', $type_arr);
        $this->assign('type_arr', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);


//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        $lists = $lists->where('delete_time', 1);
        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);

        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }


    /**
     *列表
     * @adminMenu(
     *     'name'   => '钢板库存管理',
     *     'parent' => 'admin/Plate/de',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function index()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);

        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);
        $company_id_arr = Db::name('company')
            ->column('name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $partno_id_arr = Db::name('partno')
            ->column('name', 'partno_id');
        $this->assign('partno_id_arr', $partno_id_arr);
        $lists = Plate::order('id desc');
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);

        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }


        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $this->assign('type_arr1', $type_arr);
        $this->assign('type_arr', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);


//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        $lists = $lists->where('delete_time', 0);
        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);

        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '成品库存管理',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function indextype1()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $type = 1;
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);

        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $this->assign('type_arr', $type_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);
//        $company_id_arr = Db::name('company')
//            ->column('name', 'id');
//        $this->assign('company_id_arr', $company_id_arr);
        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');

        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

//        var_dump($params);
        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');

        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);

//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        $lists = $lists->where('delete_time', 0);
        if ($type) {
            $lists = $lists->where('type', $type);
            $this->assign('type', $type);
        }

        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);
//        var_dump(Db::name('palte')->getLastSql());
//var_dump($type);s
        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '实验库存管理',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function indextype2()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $type = 2;
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);
        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $this->assign('type_arr', $type_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');


        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);


        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);

        $lists = $lists->where('delete_time', 0);
        if ($type) {
            $lists = $lists->where('type', $type);
            $this->assign('type', $type);
        }

        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);

        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '废料库存管理',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function indextype3()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $type = 3;
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);
        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];
        }
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $this->assign('type_arr', $type_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');


        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);

        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);


        $lists = $lists->where('delete_time', 0);
        if ($type) {
            $lists = $lists->where('type', $type);
            $this->assign('type', $type);
        }

        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);

        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '半成品库存管理',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function indextype4()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $type = 4;
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);

        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);
        $this->assign('user_arr', $user_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $this->assign('type_arr', $type_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');


        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);

        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);


        $lists = $lists->where('delete_time', 0);
        if ($type) {
            $lists = $lists->where('type', $type);
            $this->assign('type', $type);
        }

        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);

        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '头尾库存管理',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function indextype5()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $type = 5;
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);
        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $this->assign('type_arr', $type_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');


        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);

        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);


//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        $lists = $lists->where('delete_time', 0);
        if ($type) {
            $lists = $lists->where('type', $type);
            $this->assign('type', $type);
        }

        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);

        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '封闭库存管理',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function indextype6()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $type = 6;
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);
        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $this->assign('type_arr', $type_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');


        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);

        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);

//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        $lists = $lists->where('delete_time', 0);
        if ($type) {
            $lists = $lists->where('type', $type);
            $this->assign('type', $type);
        }

        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);

        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '原料库存管理',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */

    public function indextype7()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $type = 7;
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);
        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $this->assign('type_arr', $type_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');


        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);

        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);
//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        $lists = $lists->where('delete_time', 0);
        if ($type) {
            $lists = $lists->where('type', $type);
            $this->assign('type', $type);
        }

        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);

        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '委外库存管理',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function indextype8()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $type = 8;
        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);
        foreach ($params as $newk => $newv) {
//            var_dump($newk);
//            var_dump($newv);
            if (!empty($newv)) {
                $where[$newk] = $newv;
            }
        }
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);

        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);

        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $this->assign('type_arr', $type_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');


        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);

        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);

        $lists = $lists->where($where);
        $lists = $lists->where('delete_time', 0);
        if ($type) {
            $lists = $lists->where('type', $type);
            $this->assign('type', $type);
        }

        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);


        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);

        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);


        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '样品库存管理',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function indextype9()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $type = 9;
        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);
        foreach ($params as $newk => $newv) {
//            var_dump($newk);
//            var_dump($newv);
            if (!empty($newv)) {
                $where[$newk] = $newv;
            }
        }
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);

        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);

        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');

        $this->assign('user_arr', $user_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
//        var_dump($type_arr);
//        var_dump($res[1]);
//        exit();
//        $type_arr = array(1 => '成品库', 2 => '实验库', 3 => '废料库', 4 => '半成品库', 5 => '头尾库', 6 => '封闭库', 7 => '原料库', 8 => '委外库');
        $this->assign('type_arr', $type_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('id desc');


        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);

        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);
        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);

        $lists = $lists->where($where);
        $lists = $lists->where('delete_time', 0);
        if ($type) {
            $lists = $lists->where('type', $type);
            $this->assign('type', $type);
        }

        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);


        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);

        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);


        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }


    /**
     * @adminMenu(
     *     'name'   => '删除成品',
     *     'parent' => 'indexdel',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '新增',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public function indexdel()
    {
        //搜索部分
//        $key_status = input('get.key_status/d');
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $this->assign('coil_id_arr_da', $coil_id_arr_da);
//        $this->assign('coil_id_arr_da1', $coil_id_arr_da);
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $this->assign('wear_arr', $wear);
        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');
        $company_id_arr = Db::name('company')
            ->column('name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $this->assign('user_arr', $user_arr);
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');
        $this->assign('companytypea_arr', $companytypea_arr);
        $warehouse = Db::name('warehouse')->column('warehouse_id,warehouse_name');
        $type_arr = array();

        foreach ($warehouse as $r) {

            $t = $r['warehouse_id'];

            unset($r['warehouse_id']);

            $type_arr[$t] = $r['warehouse_name'];


        }
        $this->assign('type_arr', $type_arr);
        $company_id_arr = Db::name('company')
            ->column('name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');
        $this->assign('ht_id_arr', $ht_id_arr);
        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');
        $this->assign('steel_grade_id_arr', $steel_grade_id_arr);
        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $this->assign('plate_id_arr', $plate_id_arr);
        $lists = Plate::order('delete_time desc');
//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        $lists = $lists->where('delete_time', '>', 0);
        $lists = $lists->paginate(['list_rows' => 100, 'query' => [
            //'key_status' => $key_status
        ]]);

        return $this->fetch('', ['lists' => $lists->toArray(), 'page' => $lists->render(), 'domain' => request()->domain() . '/upload/']);
    }

    /**
     * @adminMenu(
     *     'name'   => '新增',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '新增',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public function add()
    {
        $type = input('id');
//        var_dump($type);
//        exit();
        $warehouse_id_arr = Db::query('select warehouse_id,warehouse_name from cmf_ware where delete_time =0');
        $this->assign('warehouse_id_arr', $warehouse_id_arr);
        $this->assign('type', $type);
        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr', $companytypea_arr);
        $type_arr = array(1 => '成品库', 2 => '实验库', 3 => '废料库', 4 => '半成品库', 5 => '头尾库', 6 => '封闭库', 7 => '原料库', 8 => '委外库');
        $this->assign('type_arr', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        $this->assign('coil_id_arr', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr', $ht_id_arr);
        return $this->fetch('', ['domain' => request()->domain() . '/upload/']);
    }

    /**
     * @adminMenu(
     *     'name'   => '新增提交',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '新增提交',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public function addPost()
    {
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        $params['update_time'] = time();
        $params['add_time'] = time();
        $params['admin_id'] = cmf_get_current_admin_id();
//        Plate::create($params);
        $id = Db::name('plate')->insertGetId($params);
        $params['id'] = $id;
        cmf_install_log($params, 'plate_log', 'add');
        $this->success('操作成功', 'index');
    }

    /**
     * @adminMenu(
     *     'name'   => '修改',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '修改',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public function edit()
    {
        $id = input('get.id/d');

        if (!is_numeric($id)) {
            $this->error('非法参数');
        }
        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr', $companytypea_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr', $company_id_arr);
        $res = Plate::where('id', $id)->find();
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr', $ht_id_arr);
        $company_id_arr = Db::name('company')
            ->column('name,abb_name', 'id');
        $this->assign('company_id_arr', $company_id_arr);
        return $this->fetch('', ['vo' => $res, 'domain' => request()->domain() . '/upload/']);
    }

    /**
     * @adminMenu(
     *     'name'   => '修改提交',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '修改提交',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public function editPost()
    {
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        if (!$params || empty($params['id'])) {
            $this->error('非法参数');
        }
        $params['update_time'] = time();
        $params['admin_id'] = cmf_get_current_admin_id();
        Plate::update($params);
        cmf_install_log($params, 'plate_log', 'update');
        $this->success('操作成功', 'index');
    }

    /**
     * @adminMenu(
     *     'name'   => '删除',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '删除',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public function del()
    {
        $id = input('get.id/d');

        if (!(is_numeric($id) && $id > 0)) {
            $this->error('非法参数');
        }

        Plate::where('id', $id)->update(array('delete_time' => time(), 'update_time' => time(), 'admin_id' => cmf_get_current_admin_id()));
        $params = Db::name('plate')->where('id', $id)->find();
        cmf_install_log($params, 'plate_log', 'del');
        $this->success('删除成功');
    }

    public function field()
    {
        $id = input('get.id/d');
        $field = input('get.field');

        if (!(is_numeric($id) && $id > 0 && $field)) {
            $this->error('非法参数');
        }

        $info = Plate::field($field)->where('id', $id)->find();

        $this->success('ok', '', $info[$field]);
    }

    public function getname()
    {
        $type = input();
        if ($type) {
            $type = $type[0];
        } else {
            $type = 4;
        }
        $typearray = array(1 => 'C', 2 => 'S', 3 => 'F', 4 => 'B', 5 => 'T', 6 => 'FB', 7 => 'YP',);
        $log = $typearray[$type];
        $today = date('ymd', time());
//        $this->success('ok', '',$today);
        $newnum = Db::name('plate_num')->where('today', $today)->order('id desc')->find();
        if ($newnum) {
            Db::name('plate_num')->insertGetId(array('today' => $today, 'order_num' => $newnum['order_num'] + 1, 'addtime' => time(),
                'admin_id' => cmf_get_current_admin_id()));
            $dd = str_pad($newnum['order_num'] + 1, 5, '0', STR_PAD_LEFT);
            $name = $log . $today . $dd;
            $this->success('ok', '', $name);
        } else {
            Db::name('plate_num')->insertGetId(array('today' => $today, 'order_num' => 1, 'addtime' => time(),
                'admin_id' => cmf_get_current_admin_id()));
            $dd = str_pad(1, 5, '0', STR_PAD_LEFT);

            $name = $log . $today . $dd;
            $this->success('ok', '', $name);
        }

    }

    /**
     * @adminMenu(
     *     'name'   => '钢卷入库',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '钢卷入库',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public
    function platesaddPost()
    {
        $post_data = $this->request->param();
//        var_dump($post_data);
//        exit();
        $plan_id = $post_data['plan_id'];
        $data = array();
        foreach ($post_data['post'] as $k => $v) {
            $d = Db::name('plate')->where($v)->find();
            $v['add_time'] = time();
            $v['update_time'] = time();
            $v['admin_id'] = cmf_get_current_admin_id();
//            ->update(array('delete_time' => time(),'admin_id'=>cmf_get_current_admin_id()));

//            $data[$k] = $v;
            if (!$d) {
                array_push($data, $v);
            }
        }
//        if (!$params) {
//            $this->error('非法参数');
//        }
//        $params['add_time'] = time();
//        var_dump($params);
//        Plate::create($params);
//        var_dump($data);

        Db::startTrans();

        $list = Db::name('plate')->insertAll($data);
//        var_dump(Db::name('plate')->getLastSql());

        if ($list) {

            foreach ($post_data['data'] as $k => $v) {
//var_dump($v['weight']);exit();
                $coil = Db::name('coil')->where('id', $k)->find();

                if ($v['weight'] == '') {
                    Db::rollback();
                    $this->error('未填写钢卷剩余数量');
                }
                if ($coil['weight'] < $v['weight']) {
                    $this->error('剩余数量不得大于现有数量');
                    Db::rollback();
                }
                if ($v['weight'] == 0) {
                    Db::name('coil')->where('id', $k)->update(array('update_time' => time(), 'weight' => $v['weight'], 'locator' => $v['kuwei'], 'delete_time' => time(), 'admin_id' => cmf_get_current_admin_id()));
                } else {
                    Db::name('coil')->where('id', $k)->update(array('update_time' => time(), 'weight' => $v['weight'], 'locator' => $v['kuwei'], 'admin_id' => cmf_get_current_admin_id()));
                }

            }
            Db::name('plan')->where('id', $plan_id)->update(array('update_time' => time(), 'status' => 3, 'admin_id' => cmf_get_current_admin_id()));
            Db::commit();
            $this->success('操作成功,计划已关闭', 'plan/index');
        } else {
            $this->error('操作失败');
        }
//
//        $this->success('操作成功', 'index');
    }

    /**
     * @adminMenu(
     *     'name'   => '钢板入库',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '钢卷入库',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public
    function platesaddPostnew()
    {
        $post_data = $this->request->param();
//        var_dump($post_data);
        $plan_id = $post_data['plan_id'];
        $data = array();
//        if ()
        foreach ($post_data['post'] as $k => $v) {
            $v['add_time'] = time();
            $v['update_time'] = time();
            $v['admin_id'] = cmf_get_current_admin_id();

            array_push($data, $v);
        }

        Db::startTrans();
        $list = Db::name('plate')->insertAll($data);

        if ($list) {

            foreach ($post_data['post'] as $k => $v) {

                Db::name('plate')->where('id', $v['parent_id'])
                    ->update(array('update_time' => time(), 'delete_time' => time(),
                        'admin_id' => cmf_get_current_admin_id()));
            }
            Db::name('plan')->where('id', $plan_id)->update(array('update_time' => time(), 'status' => 3, 'admin_id' => cmf_get_current_admin_id()));
            Db::commit();
            $this->success('操作成功,计划已关闭', url('Plannew/index'));
//            $this->redirect(url('plannew/runindex'));
        } else {
            Db::rollback();
            $this->error('操作失败');
        }
    }

    /**
     * @adminMenu(
     *     'name'   => '钢板入库保存',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '钢板入库保存',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public
    function platesaddPostnew1()
    {
        $post_data = $this->request->param();
//        var_dump($post_data);
        $plan_id = $post_data['plan_id'];
        $data = array();
        if (isset($post_data['post'])) {
            foreach ($post_data['post'] as $k => $v) {
                $v['add_time'] = time();
                $v['update_time'] = time();
                $v['admin_id'] = cmf_get_current_admin_id();

                array_push($data, $v);
            }

            Db::startTrans();
            $list = Db::name('plate')->insertAll($data);
//var_dump($list);
            if ($list) {

//            foreach ($post_data['post'] as $k => $v) {
//
//                Db::name('plate')->where('id', $v['parent_id'])
//                    ->update(array('update_time' => time(), 'delete_time' => time(),
//                        'admin_id' => cmf_get_current_admin_id()));
//            }
//            Db::name('plan')->where('id', $plan_id)->update(array('update_time' => time(), 'status' => 3, 'admin_id' => cmf_get_current_admin_id()));
                Db::commit();
//                $this->redirect(url('plannew/runindex'));
                $this->success('操作成功', url('Plannew/runindex'));
            } else {
                Db::rollback();
                $this->error('操作失败');
            }
        } else {
//            $this->success('操作成功', url('Plannew/runindex'));
            $this->error('操作失败');

        }
    }

    /**excel 导出
     *      *   @adminMenu(
     *     'name'   => 'excel导出',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '接收计划',
     *     'param'  => ''
     * )
     * @return void
     */
    public
    function outexcel()
    {


        $typess = input('typess');

        //要导出的数据,二维
        $lists = Plate::order('id desc');
//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        if ($typess) {
            $lists = $lists->where('type', $typess);
        }
        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);
        $lists = $lists->where('delete_time', 0);
        $lists = $lists->paginate(['list_rows' => 100000, 'query' => [
            //'key_status' => $key_status
        ]]);


        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);
        $type_arr = array(1 => '成品库', 2 => '实验库', 3 => '废料库', 4 => '半成品库', 5 => '头尾库', 6 => '封闭库', 7 => '原料库', 8 => '委外库');
        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);

        $data = $lists->toArray();
        $data = $data['data'];
        $newdata = array();

//类型
        $type = array(1 => '成品库', 2 => '实验库', 3 => '废料库', 4 => '半成品库', 5 => '头尾库', 6 => '封闭库', 7 => '原料库', 8 => '委外库');

        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');

        $company_id_arr = Db::name('company')
            ->column('name', 'id');

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');

        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');

        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');

        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');

        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');
        foreach ($data as $k => $vo) {
            $newdata[$k] = $vo;
            $newdata[$k]['add_time'] = date('Y-m-d H:i', $vo['add_time']);
            $newdata[$k]['update_time'] = date('Y-m-d H:i', $vo['update_time']);
            $newdata[$k]['type'] = isset($type[$vo['type']]) ? $type[$vo['type']] : '';
            $newdata[$k]['grade_id'] = isset($grade_id_arr[$vo['grade_id']]) ? $grade_id_arr[$vo['grade_id']] : '';
            $newdata[$k]['steel_id'] = isset($steel_grade_id_arr[$vo['steel_id']]) ? $steel_grade_id_arr[$vo['steel_id']] : '';
            $newdata[$k]['coil_id'] = isset($coil_id_arr_da[$vo['coil_id']]) ? $coil_id_arr_da[$vo['coil_id']] : '';
            $newdata[$k]['ht_id'] = isset($ht_id_arr[$vo['ht_id']]) ? $ht_id_arr[$vo['ht_id']] : '';
            $newdata[$k]['company_id'] = isset($company_id_arr[$vo['company_id']]) ? $company_id_arr[$vo['company_id']] : '';
            $newdata[$k]['parent_id'] = isset($plate_id_arr[$vo['parent_id']]) ? $plate_id_arr[$vo['parent_id']] : '';
            $newdata[$k]['admin_id'] = isset($user_arr[$vo['admin_id']]) ? $user_arr[$vo['admin_id']] : '';
            $newdata[$k]['companytype'] = isset($companytypea_arr[$vo['companytype']]) ? $companytypea_arr[$vo['companytype']] : '';
        }


        $head = array('类型',
            '归属类型',
            '捆包号',
            '牌号',
            '钢种号',
            '钢卷号',
            '厚',
            '宽',
            '长',
            '合同号',
            '客户名称',
            '张数',
            '重量（吨）',
            '库位',
            '备注',
            '添加时间',
            '更新时间',
            '最后操作人',);

        //数据中对应的字段，用于读取相应数据：
        $keys = [
            'type',
            'companytype',
            'name',
            'grade_id',
            'steel_id',
            'coil_id',
            'd',
            'w',
            'h',
            'ht_id',
            'company_id',
            'sheets',
            'weight',
            'kuwei',
            'remark',
            'add_time',
            'update_time',
            'admin_id',
        ];


//        $head = array('id', 'name');//设置表头
//        $keys = ['id','name'];//数据中表头对应的字段，用于读取相应数据
//        var_dump($data);
        if ($typess) {
//            $lists = $lists->where('type', $typess);
            excel_out($type[$typess] . '钢板导出' . date('ymdhis', time()), $newdata, $head, $keys);
        }

        excel_out('钢板导出' . date('ymdhis', time()), $newdata, $head, $keys);

    }

    public function outexcelpandian()
    {
        $typess = input('typess');

        //要导出的数据,二维
        $lists = Plate::order('id desc');
//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        if ($typess) {
            $lists = $lists->where('type', $typess);
        }
        $where = array();
        $params = array_map(function ($v) {
            return is_array($v) ? implode(',', $v) : $v;
        }, input('post.'));

        unset($params['typess']);

        $mohu = ['name', 'remark'];
        foreach ($params as $newk => $newv) {

            if (!empty($newv)) {

                if (!in_array($newk, $mohu)) {
                    $where[$newk] = trim($newv);

                } else {
                    $lists = $lists->where($newk, 'like', '%' . trim($newv) . '%');
                }

            }
        }

        $lists = $lists->where($where);
        $this->assign('vo', $params);
        $lists = $lists->where('delete_time', 1);
        $lists = $lists->paginate(['list_rows' => 100000, 'query' => [
            //'key_status' => $key_status
        ]]);


        $companytypea_arr = array(0 => array('id' => 1, 'name' => '自主'), 1 => array('id' => 2, 'name' => '来料'), 2 => array('id' => 3, 'name' => '委外'));
        $this->assign('companytypea_arr1', $companytypea_arr);
        $type_arr = array(1 => '成品库', 2 => '实验库', 3 => '废料库', 4 => '半成品库', 5 => '头尾库', 6 => '封闭库', 7 => '原料库', 8 => '委外库');
        $this->assign('type_arr1', $type_arr);
        $company_id_arr = Db::query('select id,name from cmf_company where delete_time =0');
//        var_dump($company_id_arr);
        $this->assign('company_id_arr1', $company_id_arr);
        $grade_id_arr = Db::query('select id,g_name from cmf_grade where delete_time =0');
        $this->assign('grade_id_arr1', $grade_id_arr);
        $steel_id_arr = Db::query('select id,name from cmf_steel_grade where delete_time =0');
        $this->assign('steel_id_arr1', $steel_id_arr);
        $coil_id_arr = Db::query('select id,coilno from cmf_coil where delete_time =0');
        $this->assign('coil_id_arr1', $coil_id_arr);
        $ht_id_arr = Db::query('select id,ht_number,ht_name from cmf_ht where delete_time =0');
        $this->assign('ht_id_arr1', $ht_id_arr);

        $data = $lists->toArray();
        $data = $data['data'];
        $newdata = array();

//类型
        $type = array(1 => '成品库', 2 => '实验库', 3 => '废料库', 4 => '半成品库', 5 => '头尾库', 6 => '封闭库', 7 => '原料库', 8 => '委外库');

        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');

        $company_id_arr = Db::name('company')
            ->column('name', 'id');

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');

        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');

        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');

        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');
        foreach ($data as $k => $vo) {
            $newdata[$k] = $vo;
            $newdata[$k]['add_time'] = date('Y-m-d H:i', $vo['add_time']);
            $newdata[$k]['update_time'] = date('Y-m-d H:i', $vo['update_time']);
            $newdata[$k]['type'] = isset($type[$vo['type']]) ? $type[$vo['type']] : '';
            $newdata[$k]['grade_id'] = isset($grade_id_arr[$vo['grade_id']]) ? $grade_id_arr[$vo['grade_id']] : '';
            $newdata[$k]['steel_id'] = isset($steel_grade_id_arr[$vo['steel_id']]) ? $steel_grade_id_arr[$vo['steel_id']] : '';
            $newdata[$k]['coil_id'] = isset($coil_id_arr_da[$vo['coil_id']]) ? $coil_id_arr_da[$vo['coil_id']] : '';
            $newdata[$k]['ht_id'] = isset($ht_id_arr[$vo['ht_id']]) ? $ht_id_arr[$vo['ht_id']] : '';
            $newdata[$k]['company_id'] = isset($company_id_arr[$vo['company_id']]) ? $company_id_arr[$vo['company_id']] : '';
            $newdata[$k]['parent_id'] = isset($plate_id_arr[$vo['parent_id']]) ? $plate_id_arr[$vo['parent_id']] : '';
            $newdata[$k]['admin_id'] = isset($user_arr[$vo['admin_id']]) ? $user_arr[$vo['admin_id']] : '';
            $newdata[$k]['companytype'] = isset($companytypea_arr[$vo['companytype']]) ? $companytypea_arr[$vo['companytype']] : '';
            $newdata[$k]['ware_id'] = isset($wear[$vo['ware_id']]) ? $wear[$vo['ware_id']] : '';

        }


        $head = array('类型',
            '归属类型',
            '捆包号',
            '牌号',
            '钢种号',
            '钢卷号',
            '厚',
            '宽',
            '长',
            '合同号',
            '客户名称',
            '张数',
            '重量（吨）',
            '库区',
            '库位',
            '工序',
            '备注',
            '添加时间',
            '更新时间',
            '最后操作人',);

        //数据中对应的字段，用于读取相应数据：
        $keys = [
            'type',
            'companytype',
            'name',
            'grade_id',
            'steel_id',
            'coil_id',
            'd',
            'w',
            'h',
            'ht_id',
            'company_id',
            'sheets',
            'weight',
            'ware_id',
            'kuwei',
            'processes',
            'remark',
            'add_time',
            'update_time',
            'admin_id',
        ];


//        $head = array('id', 'name');//设置表头
//        $keys = ['id','name'];//数据中表头对应的字段，用于读取相应数据
//        var_dump($data);
        if ($typess) {
//            $lists = $lists->where('type', $typess);
            excel_out($type[$typess] . '盘点钢板导出' . date('ymdhis', time()), $newdata, $head, $keys);
        }

        excel_out('盘点钢板导出' . date('ymdhis', time()), $newdata, $head, $keys);
    }

    /**excel 导出
     *      *   @adminMenu(
     *     'name'   => '已出库excel导出',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '接收计划',
     *     'param'  => ''
     * )
     * @return void
     */
    public
    function outexceldel()
    {
        //要导出的数据,二维
        $lists = Plate::order('delete_time desc');
//        if ($key_status) {
//            $lists = $lists->where('status', $key_status);
//        }
        $lists = $lists->where('delete_time', '>', 0);
        $lists = $lists->paginate(['list_rows' => 100000, 'query' => [
            //'key_status' => $key_status
        ]]);

        $data = $lists->toArray();
        $data = $data['data'];
        $newdata = array();

//类型
        $type = array(1 => '成品库', 2 => '实验库', 3 => '废料库', 4 => '半成品库', 5 => '头尾库', 6 => '封闭库', 7 => '原料库', 8 => '委外库');

        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');

        $company_id_arr = Db::name('company')
            ->column('name', 'id');

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');

        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');

        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');

        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');

        $user_arr = Db::name('user')
            ->column('user_nickname', 'id');
        foreach ($data as $k => $vo) {
            $newdata[$k] = $vo;
            $newdata[$k]['add_time'] = date('Y-m-d H:i', $vo['add_time']);
            $newdata[$k]['update_time'] = date('Y-m-d H:i', $vo['update_time']);

            $newdata[$k]['type'] = isset($type[$vo['type']]) ? $type[$vo['type']] : '';
            $newdata[$k]['grade_id'] = isset($grade_id_arr[$vo['grade_id']]) ? $grade_id_arr[$vo['grade_id']] : '';
            $newdata[$k]['steel_id'] = isset($steel_grade_id_arr[$vo['steel_id']]) ? $steel_grade_id_arr[$vo['steel_id']] : '';
            $newdata[$k]['coil_id'] = isset($coil_id_arr_da[$vo['coil_id']]) ? $coil_id_arr_da[$vo['coil_id']] : '';
            $newdata[$k]['ht_id'] = isset($ht_id_arr[$vo['ht_id']]) ? $ht_id_arr[$vo['ht_id']] : '';
            $newdata[$k]['company_id'] = isset($company_id_arr[$vo['company_id']]) ? $company_id_arr[$vo['company_id']] : '';
            $newdata[$k]['parent_id'] = isset($plate_id_arr[$vo['parent_id']]) ? $plate_id_arr[$vo['parent_id']] : '';
            $newdata[$k]['admin_id'] = isset($user_arr[$vo['admin_id']]) ? $user_arr[$vo['admin_id']] : '';
            $newdata[$k]['companytype'] = isset($companytypea_arr[$vo['companytype']]) ? $companytypea_arr[$vo['companytype']] : '';

        }

        $head = array('类型',
            '归属类型',
            '捆包号',
            '牌号',
            '钢种号',
            '钢卷号',
            '厚',
            '宽',
            '长',
            '合同号',
            '张数',
            '重量（吨）',
            '库位',
            '备注',
            '添加时间',
            '更新时间',
            '最后操作人',);

        //数据中对应的字段，用于读取相应数据：
        $keys = [
            'type',
            'companytype',
            'name',
            'grade_id',
            'steel_id',
            'coil_id',
            'd',
            'w',
            'h',
            'ht_id',
            'sheets',
            'weight',
            'kuwei',
            'remark',
            'add_time',
            'update_time',
            'admin_id',
        ];

//        $head = array('id', 'name');//设置表头
//        $keys = ['id','name'];//数据中表头对应的字段，用于读取相应数据
//        var_dump($data);
        excel_out('钢板导出' . date('ymdhis', time()), $newdata, $head, $keys);

    }

    /**
     * @adminMenu(
     *     'name'   => '确认入库',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '删除',
     *     'param'  => ''
     * )
     * @return mixed
     */
    public function confirm()
    {
        $id = input('get.id/d');

        if (!(is_numeric($id) && $id > 0)) {
            $this->error('非法参数');
        }
        $param = Db::name('Plate')->where('id', $id)->find();
        $name = getname($param['type']);
//        var_dump($name);
        Plate::where('id', $id)->update(array('name' => $name));
        $params = Db::name('Plate')->where('id', $id)->find();
        cmf_install_log($params, 'plate_log', 'update');
        $this->success('操作成功', 'index');
//        $this->success('成功');
    }

    /**批处理错误数据
     * @return void
     */
    public function alldata()
    {
        $plate = Plate::where('parent_id', '>', 0)->select();
        $plate = $plate->toArray();
        foreach ($plate as $key => $val) {
//            var_dump($val['parent_id']);
            $new = Plate::where('id', $val['parent_id'])->find();
            $new = $new->toArray();
            if ($new['coil_id'] > 0) {
//                var_dump($val);

                if (empty($val['coil_id'])) {
//                    var_dump($val['coil_id']);
//                    var_dump($new['coil_id']);
                }
//                Plate::where('id', $val['id'])->update(array('coil_id' => $new['coil_id']));
            } else {
                var_dump($val['id']);
            }


        }
//        var_dump($plate);
    }

    /**
     *列表
     * @adminMenu(
     *     'name'   => '钢板打印',
     *     'parent' => 'admin/Plate/indextype12',
     *     'display'=> true,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
    public function tcpdf()
    {

//        echo "This is a TSCLIBNET.Dll test in PHP 5.0.";
//        $TSCObj = new COM ("TSCSDK.driver");
//        $TSCObj->openport ("TSC TTP-2410MT");
//
//        $TSCObj->sendcommand("SIZE 100 mm, 60 mm");
//        $TSCObj->sendcommand("DIRECTION 1");
//
//        //$TSCObj->downloadpcx("G:\Program Files\Apache Software Foundation\Apache2.2\htdocs\UL.PCX","UL.PCX");
//
//        $TSCObj->clearbuffer();
//        //$TSCObj->sendcommand("PUTPCX 10,200,\"UL.PCX\"");
//        $TSCObj->sendcommand("TEXT 100,200,\"0\",0,12,12,\"12345\"");
//
//        $TSCObj->printerfont("100", "50", "4", "0", "1", "1", "TEST PRINTOUT");
//        $TSCObj->windowsfont(100, 250, 48, 0, 3, 1, "arial", "WINDOWS FONT TEST");
//
//        $TSCObj->barcode("100", "100", "128", "50", "1", "0", "2", "2", "123456789");
//        $TSCObj->printlabel("1","1");
//        $TSCObj->closeport();
//        exit();

        $id = input('id');
        if (empty($id)) {
            $this->error('数据不全');
        }
        $info = Plate::where('id', $id)->find();
        if (!$info) {
            $this->error('数据不全');
        }
        $info['weight'] = $info['weight'] * 1000;

//                The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
        $pdf = new \TCPDF('C', 'mm', array(120, 175));
//        $pdf->getPageSizeFromFormat();
        //新建一个PDF文档
        //L 横排   P竖排
        $orientation = 'P';
        $unit = 'mm';
        $format = 'A4';
        $unicode = true;
        $encoding = 'UTF-8';
        $diskcache = false;
        $pdfa = false;
//        $pdf = new \TCPDF('C', 'mm', 'A4', true, 'UTF-8',false,false, array(110,140));

        // set document information
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('钢板打印');
        $pdf->SetTitle('钢板打印');
        $pdf->SetSubject('TCPDF Tutorial');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');

        // set default header data
        //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 048', PDF_HEADER_STRING);

        // set header and footer fonts
        //$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);
        $pdf->setCellPaddings(0, 0, 0, 0);
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

        // set margins
        $pdf->SetMargins(2, 35, 2);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        $pdf->SetFillColor(232, 239, 242);
        $pdf->Rect(0, 0, $pdf->getPageWidth(), $pdf->getPageHeight(), 'F');
        // set auto page breaks
//        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

        // set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

        $pdf->SetFont('stsongstdlight', 'B', 10);
//        $pdf->SetFont('droidsansfallback', '', 10);
//        $pdf->SetFont(‘droidsansfallback’, ”, 12);

        // add a page
        $pdf->AddPage();
        $pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0);

//        $pdf->setCellHeightRatio(1.3);
//        $pdf->SetLineWidth(2);
        $wear = Db::name('ware')
            ->column('warehouse_name', 'warehouse_id');
//        $this->assign('wear_arr', $wear);
        $info['update_time'] = date('Y-m-d', $info["update_time"]);

//类型
        $type = array(1 => '成品库', 2 => '实验库', 3 => '废料库', 4 => '半成品库', 5 => '头尾库', 6 => '封闭库', 7 => '原料库', 8 => '委外库');

        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');

        $company_id_arr = Db::name('company')
            ->column('name', 'id');

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');

        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');

        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');

        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');

        $data = $info['name'];

// 生成的文件名
        $filename = 'upload/admin/kunbao/' . $info['name'] . '.png';

// 生成二维码
        $qr = new phpqrcode\QRcode();
        $qr::png($data, $filename);
        $info['grade_id'] = isset($grade_id_arr[$info['grade_id']]) ? $grade_id_arr[$info['grade_id']] : '';
        $info['steel_id'] = isset($steel_grade_id_arr[$info['steel_id']]) ? $steel_grade_id_arr[$info['steel_id']] : '';
        $info['coil_id'] = isset($coil_id_arr_da[$info['coil_id']]) ? $coil_id_arr_da[$info['coil_id']] : '';
        $info['ht_id'] = isset($ht_id_arr[$info['ht_id']]) ? $ht_id_arr[$info['ht_id']] : '';
        $info['company_id'] = isset($company_id_arr[$info['company_id']]) ? $company_id_arr[$info['company_id']] : '华星科技';
        $info['parent_id'] = isset($plate_id_arr[$info['parent_id']]) ? $plate_id_arr[$info['parent_id']] : '';
        $info['admin_id'] = isset($user_arr[$info['admin_id']]) ? $user_arr[$info['admin_id']] : '';
        $info['companytype'] = isset($companytypea_arr[$info['companytype']]) ? $companytypea_arr[$info['companytype']] : '';
        $info['ware_id'] = isset($wear[$info['companytype']]) ? $wear[$info['companytype']] : '';
        if ($info['type'] != 1 && $info['type'] != 6) {
            $info['type'] = isset($type[$info['type']]) ? $type[$info['type']] : '';
        } else {
            $info['type'] = isset($type[$info['type']]) ? $type[$info['type']] . $info['grade_id'] : '';
        }
        $info['d'] = floatval($info['d']);
        $tbl = <<<EOD
<table border="1" cellspacing="0"   style=" font-weight:bold;   text-align: center; border-collapse:collapse;">

    <tbody>
    <tr>
        <td width="30%" colspan="3" style="vertical-align: middle; vertical-align: middle; " align="center">
          <img src="/upload/admin/20230717/b45673cca6a93a59f473d888571d0537.png" width="90px" height="74" >
       
        </td>
        <th width="70%" colspan="7" align="center">
        <h1>山东华星新材料科技有限公司</div>
          
        <div style="font-size: 1em"> Shandong Huaxing New Material Tech Co., Ltd</div style="font-size: 1em">
        </th>
    </tr>
    <tr>
        <td width="60%" align="center" colspan="7">
          <div>钢卷号    Coil No</div>
          {$info['coil_id']}
        </td>
        <td width="40%" align="center" colspan="3">
            <div>品名  Product</div>
            钢板
        </td>
    </tr>
    <tr>
        <td width="60%" align="center" colspan="7">
            <div >捆包号 Bundle Package No</div>
            {$info['name']}
        </td>
        <td width="40%" align="center" colspan="3">
            <div >牌号  Grade</div>
            {$info['steel_id']}{$info['grade_id']}
        </td>
    </tr>
    <tr>
        <td width="45%" align="center" colspan="7">
            <div >日期 Date</div>
            {$info['update_time']}
        </td>
        <td width="55%" align="center" colspan="3">
            <div >厚宽长 D*W*H</div>
           {$info['d']}*{$info['w']}*{$info['h']}
        </td>
    </tr>
    <tr>
        <td width="45%" align="center" colspan="7">
            <div >理重  T,W,(kg)</div>
            {$info['weight']}
        </td>
        <td width="55%" align="center" colspan="4">
            <div >产品状态 Product Status</div>
            
           {$info['type']}
        </td>
    </tr>
    <tr>
      <td width="45%" align="center" colspan="3">
            <div>张数  Sheets</div>
            <div >{$info['sheets']}</div>
        </td>
        <td width="55%" align="center" colspan="7"  >
            <div >客户名称 Customer Name   {$info['company_id']}</div>
            归属类型:   {$info['companytype']}
        </td>
    </tr>
    
    <tr>
        <td  align="left" colspan="3">
           <img src="{$filename}" width="66" height="66">
        </td>
            <td width="55%" align="center" colspan="7"  >
            <div >库区:   {$info['ware_id']} 工序: {$info['processes']}</div>
            <div > 库位:   {$info['kuwei']}</div>
         
        </td>
    </tr>
  
    </tbody>
</table>







EOD;
//        $pdf->writeHTMLCell(0, 0, 0, 0, $tbl, 0, 0, 0, true, '', true);
        $pdf->writeHTML($tbl, true, false, false, false, '');

        // -----------------------------------------------------------------------------

        //Close and output PDF document
        $pdf->Output('收据单_' . date('YmdHis') . '.pdf', 'I');
        exit();
    }

    public function gettcpdf()
    {

        $id = input('id');
        if (empty($id)) {
            $this->error('数据不全');
        }
        $info = Plate::where('id', $id)->find();
        if (!$info) {
            $this->error('数据不全');
        }
        $info['weight'] = $info['weight'] * 1000;


        $info['update_time'] = date('Y-m-d', $info["update_time"]);

//类型
        $type = array(1 => '成品库', 2 => '实验库', 3 => '废料库', 4 => '半成品库', 5 => '头尾库', 6 => '封闭库', 7 => '原料库', 8 => '委外库');

        $companytypea_arr = array(1 => '自主', 2 => '来料', 3 => '委外');

        $company_id_arr = Db::name('company')
            ->column('name', 'id');

        $ht_id_arr = Db::name('ht')
            ->column('ht_number', 'id');

        $grade_id_arr = Db::name('grade')
            ->column('g_name', 'id');

        $steel_grade_id_arr = Db::name('steel_grade')
            ->column('name', 'id');

        $plate_id_arr = Db::name('plate')
            ->column('name', 'id');
        $coil_id_arr_da = Db::name('coil')
            ->column('coilno', 'id');


        $info['grade_id'] = isset($grade_id_arr[$info['grade_id']]) ? $grade_id_arr[$info['grade_id']] : '';
        $info['steel_id'] = isset($steel_grade_id_arr[$info['steel_id']]) ? $steel_grade_id_arr[$info['steel_id']] : '';
        $info['coil_id'] = isset($coil_id_arr_da[$info['coil_id']]) ? $coil_id_arr_da[$info['coil_id']] : '';
        $info['ht_id'] = isset($ht_id_arr[$info['ht_id']]) ? $ht_id_arr[$info['ht_id']] : '';
        $info['company_id'] = isset($company_id_arr[$info['company_id']]) ? $company_id_arr[$info['company_id']] : '华星科技';
        $info['parent_id'] = isset($plate_id_arr[$info['parent_id']]) ? $plate_id_arr[$info['parent_id']] : '';
        $info['admin_id'] = isset($user_arr[$info['admin_id']]) ? $user_arr[$info['admin_id']] : '';
        $info['companytype'] = isset($companytypea_arr[$info['companytype']]) ? $companytypea_arr[$info['companytype']] : '';

        if ($info['type'] != 1 && $info['type'] != 6) {
            $info['type'] = isset($type[$info['type']]) ? $type[$info['type']] : '';
        } else {
            $info['type'] = isset($type[$info['type']]) ? $type[$info['type']] . $info['grade_id'] : '';
        }
        $info['d'] = floatval($info['d']);
//        $tbl = '
//<table border="1" cellspacing="0"   style=" font-weight:bold;   text-align: center; border-collapse:collapse;">
//
//    <tbody>
//    <tr>
//        <td width="30%" colspan="3" style="vertical-align: middle; vertical-align: middle; " align="center">
//          <img src="/upload/admin/20230717/b45673cca6a93a59f473d888571d0537.png" width="90px" height="74" >
//
//        </td>
//        <th width="70%" colspan="7" align="center">
//        <h1>山东华星新材料科技有限公司</div>
//
//        <div style="font-size: 1em"> Shandong Huaxing New Material Tech Co., Ltd</div style="font-size: 1em">
//        </th>
//    </tr>
//    <tr>
//        <td width="60%" align="center" colspan="7">
//          <div>钢卷号    Coil No</div>
//          '.$info["coil_id"].'
//        </td>
//        <td width="40%" align="center" colspan="3">
//            <div>品名  Product</div>
//            钢板
//        </td>
//    </tr>
//    <tr>
//        <td width="60%" align="center" colspan="7">
//            <div >捆包号 Bundle Package No</div>
//             '.$info['name'].'
//        </td>
//        <td width="40%" align="center" colspan="3">
//            <div >牌号  Grade</div>
//'.$info['steel_id'].'
//        </td>
//    </tr>
//    <tr>
//        <td width="45%" align="center" colspan="7">
//            <div >日期 Date</div>
//             '.$info['update_time']'.
//        </td>
//
//    </tr>
//    <tr>
//        <td width="45%" align="center" colspan="7">
//            <div >理重  T,W,(kg)</div>
//           '.$info['weight']'.
//        </td>
//        <td width="55%" align="center" colspan="4">
//            <div >产品状态 Product Status</div>
//
//'.$info['type']'.
//        </td>
//    </tr>
//    <tr>
//      <td width="45%" align="center" colspan="3">
//            <div>张数  Sheets</div>
//            <div >'.$info['sheets']'.</div>
//        </td>
//
//    </tr>
//
//    <tr>
//        <td  align="left" colspan="10">
//           <img src="/upload/admin/20230717/393245c454f52b2f881122ba0f77ec1c.png" width="66" height="66">
//        </td>
//
//    </tr>
//
//    </tbody>
//</table>'
//;
        $this->success('获取成功', "", $tbl);
    }

}